#include "stdafx.h"
#include "Keeper.h"
#include <functional>

Keeper Disposable::LockDocument(AcApDocument * document /*= nullptr*/)
{
	if (document == nullptr)
	{
		document = acDocManager->mdiActiveDocument();
	}

	Acad::ErrorStatus es = acDocManager->lockDocument(document);

	return Keeper([document]{ acDocManager->unlockDocument(document); });
}

Keeper Disposable::ProvisionalHide(CWnd * wnd)
{
	wnd->ShowWindow(SW_HIDE);

	return Keeper([wnd]{ wnd->ShowWindow(SW_SHOW); });
}
